package com.rongmei.jdsync.dto;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 商品属性格式数据传输对象
 *
 * @author dongjun
 */
@Data
@Schema(description = "商品属性格式")
public class GoodsAttrFormatDto {
    @JsonProperty("attr_class_id")
    @Schema(description = "属性分类ID")
    private Integer attrClassId;

    @JsonProperty("attr_id")
    @Schema(description = "属性ID")
    private Integer attrId;

    @JsonProperty("attr_name")
    @Schema(description = "属性名称")
    private String attrName;

    @JsonProperty("attr_value_id")
    @Schema(description = "属性值ID")
    private Integer attrValueId;

    @JsonProperty("attr_value_name")
    @Schema(description = "属性值名称")
    private String attrValueName;

    // 处理额外的属性
    private Map<String, Object> additionalProperties = new HashMap<>();

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        additionalProperties.put(name, value);
    }
}
